//
//  MyViewController.m
//  ProjectForA
//
//  Created by hmengwei on 14/11/19.
//  Copyright (c) 2014年 hmengwei. All rights reserved.
//

#import "MyViewController.h"
#import "LoginViewController.h"
#import "DiscountedViewController.h"
#import "BeikeViewController.h"
@interface MyViewController ()<UITableViewDataSource, UITableViewDelegate>

@end

@implementation MyViewController

- (void)dealloc
{
    [_array release];
    [super dealloc];
}

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
        self.array = [NSMutableArray arrayWithObjects:@"系统版本",@"关于贝壳", @"关于我们", @"清除缓存", nil];
        
    }
    return self;
}

- (void)viewDidLoad {
    [self createView];
    self.navigationController.navigationBar.translucent = NO;
    [self.view setBackgroundColor:[UIColor whiteColor]];
    self.title = @"我的";
//    self.navigationController.navigationBar.hidden = YES;
//    self.tabBarController.tabBar.hidden = YES;
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

-(void)createView
{
 
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height )];
    [imageView setImage:[UIImage imageNamed:@"001.jpg"]];
    imageView.alpha = 0.6;

    UITableView *table = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain];
    table.dataSource = self;
    table.delegate = self;
//    [table setAlpha:0.5];
    [table registerClass:[UITableViewCell class] forCellReuseIdentifier:@"ok"];
    
    [self.view addSubview:table];
    [self.view addSubview:imageView];

    
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [_array count];
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ok" forIndexPath:indexPath];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.textLabel.text = [_array objectAtIndex:indexPath.row];
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        LoginViewController *login = [[LoginViewController alloc] init];
        [self.navigationController pushViewController:login animated:YES];
    } else if (indexPath.row == 1) {
        BeikeViewController *beike = [[BeikeViewController alloc] init];
        [self.navigationController pushViewController:beike animated:YES];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
